#!/usr/bin/env python

import sys
from itertools import groupby

if __name__ == "__main__":
    for gene_id, grp in groupby((line.split() for line in sys.stdin), key=lambda i:i[0]):
        grp = list(grp)
        length = len(grp)
        for gene_id, genome_id in grp:
            print "%s:%i\t%s" % (gene_id, length, genome_id)


